
import { createApp } from 'vue';
import TDesign from 'tdesign-vue-next';
import TDesignChat from '@tdesign-vue-next/chat'; // 引入chat组件
import Demo from './chat.vue';

// 引入组件库全局样式资源
import 'tdesign-vue-next/es/style/index.css';
import './index.css';

const app = createApp(Demo);

// 定义主题切换的方法
app.config.globalProperties.$toggleTheme = () => {
  const body = document.body;
  if (body.classList.contains('blue-theme')) {
    body.classList.remove('blue-theme');
    body.classList.add('light-theme');
  } else if (body.classList.contains('light-theme')){
    body.classList.remove('light-theme');
    body.classList.add('dark-theme');
  } else if (body.classList.contains('dark-theme')){
    body.classList.remove('dark-theme');
    body.classList.add('nature-theme');
  } else {
    body.classList.remove('nature-theme');
    body.classList.add('blue-theme');
  } 
};


app.use(TDesign).use(TDesignChat).mount('#app');
